package com.carlinfo.stu_ques.question.dao.impl;

import java.io.File;

import com.carlinfo.stu_ques.common.dao.impl.BaseDaoimpl;
import com.carlinfo.stu_ques.question.dao.IAnswerDao;
import com.carlinfo.stu_ques.question.pojo.Answer;

public class AnswerDaoImpl extends BaseDaoimpl<Answer> implements IAnswerDao
{
	private File answerFile = new File(parentFile, "answer.dat");

	public int savaOneDao(Answer answer)
	{
		answer.setId(count);
		this.tempId = answer.getId();
		int result = super.savaOneDao(answer);
		writeFile(answerFile);
		return result;
	}

	public void updateOneDao(Answer answer)
	{
		this.tempId = answer.getId();
		super.updateOneDao(answer);
		writeFile(answerFile);
	}

	public void deleteOneDao(Answer answer)
	{
		this.tempId = answer.getId();
		super.deleteOneDao(answer);
		writeFile(answerFile);
	}

	public AnswerDaoImpl()
	{
		readFile(answerFile);
	}
}
